<template>
	<view class="content">  
		<view class="page" v-if="detail.name">
			<view class="content">
				<u-parse :content="detail.content"></u-parse>
			</view>
		</view>
		<u-loading-page :loading="!detail.name" loading-text="正在加载内容..."></u-loading-page>
	</view>
</template>

<script>
	// import {
	// 	indexApi,
	// } from '@/api/api.js';
	export default {
		data() {
			return {
				id: 0,
				detail: {}
			};
		},
		onPullDownRefresh() {
			this.detail = null
			this.getDetail();
			setTimeout(() => {
				uni.stopPullDownRefresh()
			}, 1000)
		},
		onLoad(o) {
			if (!o.key) {
				uni.reLaunch({
					url: '/pages/tabbar/home/index'
				})
				return;
			}
			uni.setNavigationBarTitle({
				title: o.key == 'YHXY' ? '用户协议' : o.key == 'YSZC' ? '隐私政策' : o.key == 'CZXY'  
			})
			this.key = o.key
			this.getDetail();
		},
		methods: {
			getDetail() {
			  this.$api.getPrivacy({
					content: this.key
				}).then(res => {
					if(this.key == 'YHXY'){
						this.detail = res.data.YHXY;
					}else if(this.key == 'YSZC'){
						this.detail = res.data.YSXY;
					}
					
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		// background-color: #fff;
	}

	.content {
		padding-top: 16rpx;

		.page {
			min-height: calc(100vh - 16rpx);
			padding: 20rpx;
			box-sizing: border-box;
			background-color: #fff;

			.head {
				.title {
					font-size: 35rpx;
					font-weight: 600;
					line-height: 50rpx;
					color: #333;
				}

				.time {
					margin-top: 20rpx;
					color: #b9b9b9;
					font-size: 24rpx;
				}
			}

			.content {
				padding: 30rpx 10rpx;
				line-height: 50rpx;
				font-size: 28rpx;
				color: #333;
			}
		}
	}
</style>